xen/arm: Avoid setting/clearing HCR_RW at every context switch
authorWei Chen <Wei.Chen@arm.com>
Wed, 5 Apr 2017 09:09:06 +0000 (17:09 +0800)
committerStefano Stabellini <sstabellini@kernel.org>
Wed, 5 Apr 2017 19:12:10 +0000 (12:12 -0700)
commit24aff0561163988ec1372fa571105fd13735cd67
tree7ba2bd530a961cbd326a46394fee9cd9b66e1f6b
parent5fe09df809ca50c3901f35e8b081e7f1463336d5
xen/arm: Avoid setting/clearing HCR_RW at every context switch

The HCR_EL2 flags for 64-bit and 32-bit domains are different. But
when we initialized the HCR_EL2 for vcpu0 of Dom0 and all vcpus of
DomU in vcpu_initialise, we didn't know the domain's address size
information. We had to use compatible flags to initialize HCR_EL2,
and set HCR_RW for 64-bit domain or clear HCR_RW for 32-bit domain
at every context switch.

But, after we added the HCR_EL2 to vcpu's context, this behaviour
seems a little fussy. We can update the HCR_RW bit in vcpu's context
as soon as we get the domain's address size to avoid setting/clearing
HCR_RW at every context switch.

Signed-off-by: Wei Chen <Wei.Chen@arm.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/arm64/domctl.c
xen/arch/arm/domain.c
xen/arch/arm/domain_build.c
xen/arch/arm/p2m.c
xen/include/asm-arm/domain.h